﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Mobile/Masters/MobileSite.master" AutoEventWireup="true" CodeFile="Register.aspx.cs" Inherits="Mobile_Register" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Title" Runat="Server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="Head" Runat="Server">    
<script language="javascript" type="text/javascript">
    function moveNext(nextFieldID, bookMark) {
        document.getElementById(nextFieldID).focus();
        if (navigator.userAgent.toLowerCase().indexOf('android') != -1)
            document.getElementById('pgbrk').innerHTML = document.getElementById('pgbrk').innerHTML + "&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;";
        location.href = '#' + bookMark;
    }

    function ValidateForm() {
        //Email
        var email = document.form_register.txtEmail.value;
        var re = /^(([^&lt;&gt;()[\]\\.,;:\s@\"]+(\.[^&lt;&gt;()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

        if (email == "" || (re.test(email) == false)) {
            alert("Error: Please enter a valid email address.");
            document.form_register.txtEmail.focus();
            window.location = '#txtEmail';
            return false;
        }

        //Password
        if (document.form_register.txtPassword.value == "") {
            alert("Error: Please enter a password.");
            document.form_register.txtPassword.focus();
            window.location = '#txtPassword';
            return false;
        }

        //Confirm Password
        if (document.form_register.txtPassword.value != document.form_register.txtConfirmPass.value) {
            alert("Error: Your passwords don't match.");
            document.form_register.txtPassword.focus();
            window.location = '#txtPassword';
            return false;
        }

        //First Name
        if (document.form_register.txtFirstName.value == "") {
            alert("Error: Please enter your first name.");
            document.form_register.txtFirstName.focus();
            window.location = '#txtFirstName';
            return false;
        }

        //Last Name
        if (document.form_register.txtLastName.value == "") {
            alert("Error: Please enter your last name.");
            document.form_register.txtLastName.focus();
            window.location = '#txtLastName';
            return false;
        }

        //Country
        //if (document.form_register.dbcboCountries.value == 0) {
        if (document.form_register.dbcboCountries.options[document.form_register.dbcboCountries.selectedIndex].value == 0) {
            alert("Error: Please select your country.");
            //document.form_register.dbcboCountries.setActive();
            document.form_register.dbcboCountries.focus();
            window.location = '#dbcboCountries';
            return false;
        }

        //submit form
        //form_register.method="post";
        //form_register.action="/account/register-submit-iphone.asp";
        //form_register.submit();
        return true;
    }
</script>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadBody" Runat="Server">
    <header>
	    <div class="sortable">
		    <ul>
			    <li><a href="Default.aspx"><strong>Home</strong></a></li>
			    <li><a href="Login.aspx"><strong>Account</strong></a></li>
			    <li><a href="Default.aspx"><strong>Shelf</strong></a></li>
		    </ul>
		    <div class="edge"></div>
		    <div class="edge right"></div>
	    </div>
    </header>

    <header>	
		    <a class="goback" href="javascript: history.go(-1)"><strong>Back</strong></a>
            <h1>Registration</h1>    
    </header>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" Runat="Server">

    <div id="bookdesc">
<div style="padding:8px" id="storelisting-small">
    <h2>Provide your details</h2>
    <%--<br/>--%>
    <p>You are required to fill out every field in this section.</p>

<form onsubmit="return ValidateForm();" method="post" action="" name="form_register">
    <input type="hidden" value="" name="hdr"/>

<table cellspacing="0" cellpadding="0" border="0" summary="This table contains two columns of credit card details that you will need to fill out to purchase your shopping cart items. The 'process order' button is just after this table.">
 	<tbody>
        <tr>
 		<td valign="top">
 			
			<a name="txtEmail"></a>
			<p style="font-size:14px">			
				<b>Email Address <span style="color:red">*</span></b><br>
				<input type="email" onchange="moveNext('txtPassword','txtEmail')" value="" size="33" id="txtEmail" name="txtEmail" style="font-size:14px" tabindex="1"/>
			</p>

			<a name="txtPassword"></a>					
			<p style="font-size:14px">			
				<b>Password <span style="color:red">*</span></b><br>
				<input type="password" onchange="moveNext('txtConfirmPass','txtPassword')" value="" size="33" id="txtPassword" name="txtPassword" style="font-size:14px" tabindex="2"/>
			</p>

			<a name="txtConfirmPass"></a>
			<p style="font-size:14px">			
				<b>Confirm Password <span style="color:red">*</span></b><br>
				<input type="password" onchange="moveNext('txtFirstName','txtConfirmPass')" value="" size="33" id="txtConfirmPass" name="txtConfirmPass" style="font-size:14px" tabindex="3"/>
			</p>

			<a name="txtFirstName"></a>
			<p style="font-size:14px">			
				<b>First Name <span style="color:red">*</span></b><br>
				<input type="text" onchange="moveNext('txtLastName','txtFirstName')" value="" size="33" id="txtFirstName" name="txtFirstName" style="font-size:14px" tabindex="4"/>
			</p>

			<a name="txtLastName"></a>
			<p style="font-size:14px">			
				<b>Last Name <span style="color:red">*</span></b><br>
				<input type="text" onchange="moveNext('dbcboCountries','txtLastName')" value="" size="33" id="txtLastName" name="txtLastName" style="font-size:14px" tabindex="5"/>
			</p>

			<a name="dbcboCountries"></a>
			<p style="font-size:14px">			
				<b>Country <span style="color:red">*</span></b><br>
				<select id="dbcboCountries" name="dbcboCountries" tabindex="6">
                    <option selected="" value="0">---- Choose a country ----</option>
<option value="225">United States</option>
<option value="230">Venezuela</option>
<option value="233">Vietnam</option>
<option value="241">Zambia</option>
<option value="243">Zimbabwe</option>
				</select>
			</p>

            </td>
		</tr>
	</tbody>
</table>

	<%--<br/>--%>

	<input type="submit" id="fSubmit" value="Submit" class="button"/>

    <br/>
</form>
</div>
    </div>

</asp:Content>

